/*************************************************************************
	> File Name: 009.main函数三参数.c
	> Author: Maureen 
	> Mail: Maureen@qq.com 
	> Created Time: 五  8/27 18:54:40 2021
 ************************************************************************/

#include <stdio.h>

void output(int argc, char *argv[], char **env) {
    printf("argc = %d\n", argc);

    for (int i = 0; i < argc; i++) {
        printf("argv[%d] = %s\n", i, argv[i]);
    }

    for (int i = 0; env[i]; i++) {
        printf("env[%d] = %s\n", i, env[i]);
    }

    return ;
}

int main(int argc, char *argv[], char **env) {
    output(argc, argv, env);
    return 0;
}

//运行结果：
// ./a.out "hello world"                                                                                                     [0]
/*
argc = 2
argv[0] = ./a.out
argv[1] = hello world
env[0] = TERM_SESSION_ID=w0t0p0:0FC25859-6809-4366-8ECA-AC225EB13B3C
env[1] = SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.1FtwSlw4ca/Listeners
env[2] = LC_TERMINAL_VERSION=3.4.8
env[3] = COLORFGBG=7;0
env[4] = ITERM_PROFILE=Default
env[5] = XPC_FLAGS=0x0
env[6] = LANG=zh_CN.UTF-8
env[7] = PWD=/Users/maureen/Gitee/cpp/c/006.复杂结构与指针
env[8] = SHELL=/bin/zsh
env[9] = __CFBundleIdentifier=com.googlecode.iterm2
env[10] = SECURITYSESSIONID=186ac
env[11] = TERM_PROGRAM_VERSION=3.4.8
env[12] = TERM_PROGRAM=iTerm.app
env[13] = PATH=/Users/maureen/Workspace/Haizei/GameDevelop/cocos2d-x-3.17.2/templates:/Users/maureen/Workspace/Haizei/GameDevelop:/Users/maureen/Workspace/Haizei/GameDevelop/cocos2d-x-3.17.2/tools/cocos2d-console/bin:/usr/local/bin/brew:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/Library/Apple/usr/bin
env[14] = LC_TERMINAL=iTerm2
env[15] = COLORTERM=truecolor
env[16] = COMMAND_MODE=unix2003
env[17] = TERM=xterm-256color
env[18] = HOME=/Users/maureen
env[19] = TMPDIR=/var/folders/jl/14pjh5x96wd7xwk63xkwxcx80000gn/T/
env[20] = USER=maureen
env[21] = XPC_SERVICE_NAME=0
env[22] = LOGNAME=maureen
env[23] = LaunchInstanceID=0BE7F5A1-D538-49ED-BECF-211459EE7619
env[24] = __CF_USER_TEXT_ENCODING=0x0:25:52
env[25] = ITERM_SESSION_ID=w0t0p0:0FC25859-6809-4366-8ECA-AC225EB13B3C
env[26] = SHLVL=1
env[27] = OLDPWD=/Users/maureen/Gitee/cpp/c
env[28] = ZSH=/Users/maureen/.oh-my-zsh
env[29] = PAGER=less
env[30] = LESS=-R
env[31] = LSCOLORS=Gxfxcxdxbxegedabagacad
env[32] = HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles
env[33] = COCOS_CONSOLE_ROOT=/Users/maureen/Workspace/Haizei/GameDevelop/cocos2d-x-3.17.2/tools/cocos2d-console/bin
env[34] = COCOS_X_ROOT=/Users/maureen/Workspace/Haizei/GameDevelop
env[35] = COCOS_TEMPLATES_ROOT=/Users/maureen/Workspace/Haizei/GameDevelop/cocos2d-x-3.17.2/templates
env[36] = _=/Users/maureen/Gitee/cpp/c/006.夃�惽�练�惾��七�惬��郲��/./a.out
*/
